<template>
  <Spin :spinning="loading" tip="Loading...">
    <div class="claim_check">
    <!-- <div> -->
    <!-- table -->
    <BreakSpace label="工单及车辆信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel1" :list="formList" :cols="4" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle1" />

    <BaseDialog :visible.sync="responsible" :title="'责任商选择'" width="850px" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <ResponsibleList @close="responsibleClose" @save="responsibleSave" :rowDate="rowDate"></ResponsibleList>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangxianxiangdaima" :title="'故障现象选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectguzhangxianxiang @close="guzhangxianxiangdaimanClose" @save="guzhangxianxiangdaimaSave"></Selectguzhangxianxiang>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangyuanyin" :title="'故障原因选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectguzhangyuanyin @close="guzhangyuanyinClose" @save="guzhangyuanyinSave"></Selectguzhangyuanyin>
    </BaseDialog>
    <BaseDialog :visible.sync="zifeigongdanFlag" :title="'自费工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectzifeigongdan @close="zifeigongdanClose" @save="zifeigongdanSave"></Selectzifeigongdan>
    </BaseDialog>
    <BaseDialog :visible.sync="jiuyuandanFlag" :title="'救援单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectjiuyuandan @close="jiuyuandanClose" @save="jiuyuandanSave"></Selectjiuyuandan>
    </BaseDialog>
    <BaseDialog :visible.sync="weixiuxiangmulistaddflag" :title="'维修项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Weixiuxiangmulist @close="weixiuxiangmulistClose" @save="weixiuxiangmulistSave"></Weixiuxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="isvideo" :title="'视频预览'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <videos @close="dealercloseHandler" :src="src" />
    </BaseDialog>
    <BaseDialog :visible.sync="peijianhuanshangjianlistaddflag" :title="'备件换上件新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Peijianhuanshangjianlist @close="peijianhuanshangjianClose" @save="peijianhuanshangjianSave"></Peijianhuanshangjianlist>
    </BaseDialog>
    <BaseDialog :visible.sync="fujiaxiangmulistaddflag" :title="'附加项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <fujiaxiangmulist @close="fujiaxiangmuClose" @save="fujiaxiangmuSave"></fujiaxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="remarkFlag" :title="'审核备注选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <selectDelearPage @close="remarkClose" @save="remarkSave"></selectDelearPage>
    </BaseDialog>
    <BaseDialog :title="'上传附件'" :visible.sync="upVisible" destroyOnClose>
      <uploadFile :rowData="uploadDate" @close="upVisible = false" @save="saveFile"></uploadFile>
    </BaseDialog>
    <BreakSpace label="预授权信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel2" :list="formList1" :cols="4" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle2" />
    <BreakSpace label="服务中心上传附件" :containerStyle="{ marginBottom: '10px' }" />
    <!--    <UploadFile action-url="/api/file/oss/upload" :initial-value="form.fileList" :fileTypes="['mp4','avi','rmvb','WMV']" :fileSize="100" :isOnlyButton="true"  :limit="10000" @change="successHandler">上传附件</UploadFile>-->
    <FilterTable
      ref="fileTable"
      :columns="columnsFile"
      columnsRef="whbydUploadFile"
      :isSelectColumn="false"
      :onColumnsChange="(columnsFile) => (this.columnsFile = columnsFile)"
      height="auto"
      :dataSource="list"
    />
    <BreakSpace label="维修项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="weixiuxiangmutable"
      :columns="columns"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns) => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      :isPagination="false"
      height="auto"
    >
    </FilterTable>

    <div style="margin-bottom: 1rem"></div>
    <BreakSpace label="备件换上件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="peijianhuanshangjiantable"
      :columns="columns1"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns1) => (this.columns1 = columns1)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      :isPagination="false"
      height="auto"
    >
    </FilterTable>
      <BreakSpace label="旧件列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table2"
        :columns="columnshuanxiajian"
        :params="fetchParams"
        :dataSource="huanxiajiandataList"
        :datakey="'items'"
        :onColumnsChange="(columnshuanxiajian) => (this.columnshuanxiajian = columnshuanxiajian)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        :isPagination="false"
        height="auto"
      >
        <template slot="controls" slot-scope="props">
          <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanxiajianadd()">添加</multiuse-button>-->
        </template>
      </FilterTable>
    <BreakSpace label="附加项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="fujiaxiangmutable"
      :columns="columnsfujiaxiangmu"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columnsfujiaxiangmu) => (this.columnsfujiaxiangmu = columnsfujiaxiangmu)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
      :isPagination="false"
      height="auto"
    >
    </FilterTable>
    <BreakSpace label="费用信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel3" :list="feiyongformList" :cols="4" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle3" />
    <LazyLoadTab :destroyOnClose="true" v-model="activeName" :tabMenus="menus" @tab-click="tabMenusFn"></LazyLoadTab>
      <BreakSpace label="审核记录" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="checkHisListtable"
        :columns="checkHisList"
        :params="fetchParams"
        :datakey="'items'"
        :onColumnsChange="(checkHisList) => (this.checkHisList = checkHisList)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        height="auto"
        :isPagination=false
      >
      </FilterTable>

      <div style="padding-top: 3rem"></div>
      <BreakSpace label="厂端上传附件" :containerStyle="{ marginBottom: '10px' }" />
      <Spin :spinning="loading" tip="Loading...">
        <UploadFile  v-if="1 === 1":action-url='`${uploadPrefix}/api/file/oss/upload`':initial-value="form.oemFileList" :fileTypes="['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf', 'rar', 'zip','mp4','avi','rmvb','WMV','ins','inr']" :fileSize="20" :isOnlyButton="true"  :limit="5" @change="successHandler">附件上传</UploadFile>
        <FilterTable
          ref="oemFileTable"
          :columns="columnsFileOem"
          columnsRef="whbydUploadFile"
          :isSelectColumn="false"
          :onColumnsChange="columnsFileOem => (this.columnsFileOem = columnsFileOem)"
          height=auto
          :dataSource="list"
        />
      </Spin>
    <div style="padding-top: 3rem"></div>
    <BreakSpace label="审核备注" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanelbeizhu" :list="formListbeizhu" :cols="1" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandle4" />
    <div style="padding-top: 3rem"></div>
    <div style="padding-top: 3rem"></div>
    <div
      :style="{
        position: 'fixed',
        left: 0,
        right: 0,
        bottom: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <multiuse-button type="primary" @click="back" v-show="editIds.length > 0" :disabled="index == 0">上一单</multiuse-button>
      <multiuse-button type="primary" @click="next" v-show="editIds.length > 0" :disabled="index == editIds.length - 1">下一单</multiuse-button>
      <multiuse-button type="primary" :click="tongGuo.bind()" :disabled="editIds[index] && editIds[index].status == 1">通过</multiuse-button>
      <multiuse-button type="primary" :click="refuse.bind()" :disabled="editIds[index] && editIds[index].status == 1">拒绝</multiuse-button>
      <multiuse-button type="primary" :click="reject.bind()" :disabled="editIds[index] && editIds[index].status == 1">驳回</multiuse-button>
      <multiuse-button @click="closeDialog">关 闭</multiuse-button>
    </div>
     </div>
  </Spin>
</template>
<script>
import {copyUpdateData, isFormEmpty} from '@/utils/index';
import {approve, cmsClaimTypeStr, queryRepairVehicleList, quyRpPreAuth} from '@/api/claim/factory/AuthCheck';
import { getVehicleByVin } from '@/api/claim/dealer/AuthApplication';
import selectDelearPage from './selectDelearPage.vue';
import {dictionary} from '@/utils/dictMixin';
import moment from 'moment';
import videos from '@/pages/claimDemage/BasicData/AuthApplication/videos.vue'
import uploadFile from '@/pages/claimDemage/BasicData/AuthQueryDealer/uploadFile.vue';
import ResponsibleList from '@/pages/claimDemage/tools/ResponsibleList.vue';
import {sleep} from '@/utils';
import {findFileByUrl} from '@/api/partsmanage/financialManagement/capitalAccount/index';
import config from '@/assets/js/config';
export default {
    mixins: [dictionary],
    props: ['rowData', 'editIds'],
    components: {
      selectDelearPage,
      videos,
      uploadFile,
      ResponsibleList
    },
    data() {
      return {
        uploadPrefix: config.uploadUrl,// 附件上传前缀
        form: {
          fileList: [],
          oemFileList:[]
        },
        src:null,
        list: [],
        isvideo:false,
        syncList: [],
        columnsFile: this.createdTable(),
        columnsFileOem: this.createdTableOem(),
        loading: false,
        uploadDate: {},
        upVisible: false,
        fileList: [],
        oemFileList:[],
        index: 0,
        saveData: {}, //保存对象
        saveData1: null,
        saveData2: null,
        saveData3: null,
        saveData4: null,
        partId: null,
        supId: null,
        authId: null,
        saveFlag: 8,
        authNo: null,
        faId: null,
        frId: null,
        addAmount: null,
        supCode: null,
        responsibleCode:null,
        responsibleId:null,
        isDeleted: null,
        jiuyuandanFlag: false,
        faultAppear: null,
        labourAmount: null,
        partAmount: null,
        modelId: null,
        modelCode: null,
        outId: null,
        outName: null,
        dataList: [],
        dataList1: [],
        weixiuxiangmudataList: [],
        peijianhuanshangjiandataList: [],
        peijianhuanxiajiandataList: [],
        fujiaxiangmudataList: [],
        huanxiajiandataList:[],
        visible: false,
        visibleDrawer: false,
        fujiaxiangmuCloselistaddflag: false,
        weixiuxiangmulistaddflag: false,
        peijianhuanshangjianlistaddflag: false,
        fujiaxiangmulistaddflag: false,
        peijianhuanxiajianlistaddflag:false,
        collapse: false,
        zifeigongdanFlag: false,
        weixiugongdan: false,
        guzhangyuanyin: false,
        zhusunjian: false,
        responsible: false,
        guzhangxianxiangdaima: false,
        infoId: null,
        // topFilterInit: this.topFilterInitFun(),
        flterValue: {}, //参数
        checkHisList: this.checkHisList1(),
        columns: this.creatHeader(),
        columns1: this.creatHeader1(),
        columnsfujiaxiangmu: this.columnsfujiaxiangmu1(),
        columnshuanxiajian: this.columnshuanxiajianFn(),
        // fetchApi: getUser,
        fetchParams: {}, //ipa 接口
        selectedRows: [], //选中经销商
        hejifeiyong: 0.0,
        gongshifeiyong: 0.0,
        peijianfeiyong: 0.0,
        sumfujiafeiyongz: 0,
        sumweixiufeiyongz: 0,
        partAmountsumz: 0,
        sumfujiafeiyong: 0,
        sumPeiJianFeiYong: 0,
        fujiaxiangmufeiyong: 0.0,
        formListbeizhu: this.formListbeizhuform(),
        formList: this.createFormList(),
        formList1: this.createFormList1(),
        feiyongformList: this.feiyongformList1(),
        remarkFlag: false,
        activeName: '',
        radioIndex:0,
        radioPartIndex:0,
        menus: [
          // {
          //   title: '审核记录',
          //   path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/shenhejilu',
          //   params: {
          //     authId: this.rowData.authId,
          //   },
          // },
          // {
          //   title: '维修历史',
          //   path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/weixiulishi',
          //   // disabled: true,
          //   params: {
          //     vin: this.rowData.vin,
          //   },
          // },
          // {
          //   title: '索赔历史',
          //   path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/suopeilishi',
          //   // disabled: true,
          //   params: {
          //     vin: this.rowData.vin,
          //   },
          // },
          // {
          //   title: '变更记录',
          //   path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/biangengjilu',
          //   // disabled: true,
          //   params: {
          //     authId: this.rowData.authId,
          //   },
          // },
          // {
          //   title: '预授权历史',
          //   path: 'claimDemage/BasicData/AuthCheck/jiLuAndLiShiForEdit/preAuth',
          //   // disabled: true,
          //   params: {
          //     vin:this.rowData.vin,
          //   }
          // },
        ],
        dataObj: {},
        tabData: {
          vin: '',
          authId: ''
        }
      };
    },
    async created() {
      this.loading = true;
      await this.chuqi();
      if (this.editIds.length) {
        await this.getAuthListByauthNo(this.editIds[0].authId);
        console.log('this.editIds');
        console.log(this.editIds);
        console.log('this.rowData1');
        console.log(this.rowData);
      } else {
        await this.getAuthListByauthNo(this.rowData.authId);
        console.log('this.rowData');
        console.log(this.rowData);
        await this.getVehicleByVin(this.rowData.vin,this.rowData.ownerCode);
        this.index = 0;
      }
      this.activeName = '审核记录';
      this.loading = false;
    },
    mounted() {
      console.log('************321');
      // this.selectRowById(this.rowData.roNo);
    },
    methods: {
      tabMenusFn() {
        if(this.editIds.length) {
          if(this.activeName == '审核记录') {
            this.menus[0].params['authId'] = this.index == 0 ? this.editIds[0].authId : this.tabData.authId;
          } else if (this.activeName == '维修历史') {
            this.menus[1].params['vin'] = this.tabData.vin;
          } else if (this.activeName == '索赔历史') {
            this.menus[2].params['vin'] = this.tabData.vin;
          } else if (this.activeName == '变更记录') {
            this.menus[3].params['authId'] = this.tabData.authId;
          } else if (this.activeName == '预授权历史') {
            this.menus[4].params['vin'] = this.tabData.vin;
          }
        } else {
          if(this.activeName == '审核记录') {
            this.menus[0].params['authId'] = this.tabData.authId || this.rowData.authId;
          } else if (this.activeName == '维修历史') {
            this.menus[1].params['vin'] = this.tabData.vin;
          } else if (this.activeName == '索赔历史') {
            this.menus[2].params['vin'] = this.tabData.vin;
          } else if (this.activeName == '变更记录') {
            this.menus[3].params['authId'] = this.tabData.authId;
          } else if (this.activeName == '预授权历史') {
            this.menus[4].params['vin'] = this.tabData.vin;
          }
        }
      },
      dealercloseHandler(){
        this.isvideo = false;
      },
      // 上传成功回调
      successHandler(val) {
        let json = JSON.parse(JSON.stringify(val));
        let data = {};
        data.createdAt = moment().format('YYYY-MM-DD HH:mm:ss');
        data.title = json[json.length - 1].name;
        data.fileUrl = json[json.length - 1].url;
        this.$refs.oemFileTable.$refs.pageTable.EXECUTE_INSERT(data);
      },
      // 获取服务端文件 to blob
      async downLoadByUrl(url, params = {}) {
        let res = await findFileByUrl(url);
        console.log(res.data)
        return res.data;
      },
      // 执行下载动作
      async downloadFile(url) {
        console.log(url)
        url = encodeURIComponent(url);
        const data = await this.downLoadByUrl(url);
        console.log('downloadUrl=====', data)
        let a = document.createElement('a');
        a.href = data;
        a.target = '_blank';
        a.click();
        a = null;
      },
      video(val){
        this.isvideo = true;
        this.src = val.fileUrl;
      },
      delVideo(val){
        console.log("#@!#!",val)
        this.$refs.fileTable.$refs.pageTable.EXECUTE_DELETE([val]);
      },
      oemDelVideo(val){
        console.log("#@!#!",val)
        this.$refs.oemFileTable.$refs.pageTable.EXECUTE_DELETE([val]);
      },
      async next() {
        if (this.index != this.editIds.length - 1) {
          this.index++;
        }
        this.loading = true;
        await this.getAuthListByauthNo(this.editIds[this.index].authId);
        if(this.activeName == '审核记录' || this.activeName == '变更记录') {
            let activeName = this.activeName;
            this.activeName = '';
            await sleep(300);
            this.activeName = activeName;
          } else if (this.activeName == '维修历史' || this.activeName == '索赔历史' || this.activeName == '预授权历史') {
            let activeName = this.activeName;
            this.activeName = '';
            await sleep(300);
            this.activeName = activeName;
          }
        this.loading = false;
      },

      async back() {
        if (this.index != 0) {
          this.index--;
          this.loading = true;
          await this.getAuthListByauthNo(this.editIds[this.index].authId);
          if(this.activeName == '审核记录' || this.activeName == '变更记录') {
            let activeName = this.activeName;
            this.activeName = '';
            await sleep(300);
            this.activeName = activeName;
          } else if (this.activeName == '维修历史' || this.activeName == '索赔历史' || this.activeName == '预授权历史') {
            let activeName = this.activeName;
            this.activeName = '';
            await sleep(300);
            this.activeName = activeName;
          }
          this.loading = false;
        }
      },
      saveFile(obj){
        let list = this.$refs.fujiaxiangmutable.$refs.pageTable.list;
        list.find(x => x.addCode == obj.addCode).addFiles = obj.length==0 ? []:obj;
        this.upVisible = false;
      },
      editFile(row){
        this.upVisible = true;
        this.uploadDate = row;
        this.uploadDate.authId = this.rowData.authId;
      },
      async getData(row) {
        let res = await edit(row.destoryId);
        this.editRow = res.data;
        this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
        this.assignment();
      },

      sumAmount() {
        let sum = 0;
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
          sum += Number(x.addAmount);
        });

        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
          sum += Number(x.cmsClaimAmount);
        });

        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
          sum += Number(x.cmsClaimPrice);
        });

        this.feiyongformList.map((x) => {
          if ('sumAmount' == x.fieldName) {
            x.initialValue = sum;
          }
        });
      },
      async getAuthListByauthNo(authNo) {
        let res = await quyRpPreAuth(authNo);
        let data = res.data;
        //临时属性
        this.authId = data.authId;
        this.partId = data.partId; //主损件id
        this.supId = data.supId; //供应商ID
        this.supCode = data.supCode; //供应商Code
        this.responsibleId = data.responsibleId; //责任商ID
        this.responsibleCode = data.responsibleCode; //责任商Code
        this.responsiblePerson = data.responsiblePerson;
        this.labourAmount = data.labourAmount; //工时费用
        this.partAmount = data.partAmount; //备件费用
        this.seriesId = data.seriesId; //车系id
        this.seriesCode = data.seriesCode; //车系Code
        this.modelId = data.modelId; //车型id
        this.modelCode = data.modelCode; //车型Code
        this.faId = data.faId; //故障现象主键
        this.isDeleted = data.isDeleted;
        this.addAmount = data.addAmount;
        this.sumfujiafeiyongz = data.addAmount;
        this.sumweixiufeiyongz = data.labourAmount;
        this.partAmountsumz = data.partAmount;
        // this.authNo = data.authNo;
        if(this.activeName == '审核记录') {
          this.menus[0].params['authId'] = authNo;
        } else if (this.activeName == '维修历史') {
          this.menus[1].params['vin'] = res.data['vin'];
        } else if (this.activeName == '索赔历史') {
          this.menus[2].params['vin'] = res.data['vin'];
        } else if (this.activeName == '变更记录') {
          this.menus[3].params['authId'] = authNo;
        } else if (this.activeName == '预授权历史') {
          this.menus[4].params['vin'] = res.data['vin'];
        }
        this.tabData.vin = res.data['vin'];
        this.tabData.authId = authNo;
        this.outId = data.outId;
        this.outCode = data.outCode;
        this.frId = data.frId; //故障原因主键

        // this.prodDate = data.prodDate;
        // let wxLog = await getRoLogList({vin:data.vin,current:1,limit:100,currentPage:1,pageNum:1,pageSize: 100,size: 100});
        // if(wxLog.data.rows.length>=2){
        //   data.lastDrive = wxLog.data.rows[wxLog.data.rows.length-2].IN_MILEAGE;
        // }else{
        //   data.lastDrive = 0
        // }
        //为3个form赋值
        for (let i in data.fileList) {
          if (data.fileList[i].type == 55141001) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              console.log('fileUrl=====', fileUrl)
              this.formList1.find(x => x.fieldName == 'wayPicture').initialValue = [fileUrl];
            }
          } else if (data.fileList[i].type == 55141002) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              this.formList1.find(x => x.fieldName == 'wayPicture1').initialValue = [fileUrl];
            }
          } else if (data.fileList[i].type == 55141003) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              this.formList1.find(x => x.fieldName == 'wayPicture2').initialValue = [fileUrl];
            }
          } else if (data.fileList[i].type == 55141004) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              this.formList1.find(x => x.fieldName == 'wayPicture3').initialValue = [fileUrl];
            }
          } else if (data.fileList[i].type == 55141005) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              this.formList1.find(x => x.fieldName == 'wayPicture4').initialValue = [fileUrl];
            }
          } else if (data.fileList[i].type == 55141006) {
            if (data.fileList[i].fileUrl) {
              let fileUrl = await this.downLoadByUrl(data.fileList[i].fileUrl);
              this.formList1.find(x => x.fieldName == 'wayPicture5').initialValue = [fileUrl];
            }
          }

        }
        let newFile = [];
        for(let i in data.fileList){
          if(data.fileList[i].type==null){
            newFile.push(res.data.fileList[i])
          }
        }
        if(this.$refs.fileTable){
          this.$refs.fileTable.$refs.pageTable.EXECUTE_DELETE(this.$refs.fileTable.$refs.pageTable.list);
          this.$refs.fileTable.$refs.pageTable.EXECUTE_INSERT(newFile);
        }
        let oemFile = [];
        for(let i in data.oemFileList){
          if(data.oemFileList[i].type!=null){
            oemFile.push(res.data.oemFileList[i])
          }
        }
        if(this.$refs.oemFileTable){
          this.$refs.oemFileTable.$refs.pageTable.EXECUTE_DELETE(this.$refs.oemFileTable.$refs.pageTable.list);
          this.$refs.oemFileTable.$refs.pageTable.EXECUTE_INSERT(oemFile);
        }
        for (let i in data) {
          this.formList.map((y) => {
            if (i == y.fieldName) {
              y.initialValue = data[i];
            }
          });
          this.formList1.map(y => {
            if (i == y.fieldName) {
              if (data[i] || data[i] == 0) {
                y.initialValue = data[i];
              }
            }
            if ('authType' == y.fieldName) {

              y.initialValue = data.authType;

              // if (y.initialValue  == 55081003) {
              //   this.formList1.map(y => {
              //     if (y.fieldName == 'authSub') {
              //       y.hidden = false;
              //       y.initialValue = data.authSub;
              //     }
              //   })
              // } else{
              //   this.formList1.map(y => {
              //     if (y.fieldName == 'authSub') {
              //       y.hidden = true;
              //       y.initialValue = undefined;
              //     }
              //   })
              // }
            }

          });
          this.feiyongformList.map((y) => {
            if (i == y.fieldName) {
              y.initialValue = parseFloat(data[i]).toFixed(2);;
            }
          });
        }
        //为table赋值

        if (200 == res.resultCode) {
          let data = res.data;
          if (isFormEmpty(data)) {
            data = {};
          }
          let records = data.labourList;
          if (isFormEmpty(records)) {
            records = [];
          }else{
            // records.forEach(x => {
            //   x.cmsClaimPrice= parseFloat(x.cmsClaimPrice).toFixed(2);
            //   x.cmsClaimAmount= parseFloat(x.cmsClaimAmount).toFixed(2);
            // });
            for(let i=0;i<records.length;i++){
              if(10041001==records[i].isMain){
                this.radioIndex=i;
              }
              records[i].cmsClaimPrice=isFormEmpty(records[i].cmsClaimPrice)?0:records[i].cmsClaimPrice;
              records[i].cmsClaimAmount=isFormEmpty(records[i].cmsClaimAmount)?0:records[i].cmsClaimAmount;
              records[i].cmsClaimPrice= parseFloat(records[i].cmsClaimPrice).toFixed(2);
              records[i].cmsClaimAmount= parseFloat(records[i].cmsClaimAmount).toFixed(2);
            }
          }
          if(this.$refs.weixiuxiangmutable){
            this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_DELETE(this.$refs.weixiuxiangmutable.$refs.pageTable.list);
            this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(records);
          }
          let records1 = data.addList;
          if (isFormEmpty(records1)) {
            records1 = [];
          }else{
            records1.forEach(x => {
              x.addAmount= parseFloat(x.addAmount).toFixed(2);
            });
          }
          if(this.$refs.fujiaxiangmutable){
            this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_DELETE(this.$refs.fujiaxiangmutable.$refs.pageTable.list);
            this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(records1);
          }
          let records2 = data.partList;
          if (isFormEmpty(records2)) {
            records2 = [];
          }else{
            for(let i=0;i<records2.length;i++){
              if(10041001==records2[i].isMain){
                this.radioPartIndex=i;
              }
            }
          }
          if(this.$refs.table2){
            this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
            this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2);
          }
          let records3 = data.logList;
          if (isFormEmpty(records3)) {
            records3 = [];
          }
          this.$refs.checkHisListtable.$refs.pageTable.EXECUTE_INSERT(records3);
        }
        let records4 = data.partRpList;
        if (isFormEmpty(records4)) {
          records4 = [];
        }else{
          records4.forEach(x => {
            x.cmsClaimPrice= parseFloat(x.cmsClaimPrice).toFixed(2);
            x.cmsClaimAmount= parseFloat(x.cmsClaimAmount).toFixed(2);
          });
        }
        if(this.$refs.peijianhuanshangjiantable){
          this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_DELETE(this.$refs.peijianhuanshangjiantable.$refs.pageTable.list);
          this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(records4);
        }
        this.formListbeizhu.map((x) => {
          if (x.fieldName == 'checkRemarks') {
            x.initialValue = '';
          }
        });
        this.dataObj = data;
      },
      //补充车辆信息
      async getVehicleByVin(vin,ownerCode) {
        let res = await getVehicleByVin({vin:vin,ownerCode:ownerCode});
        console.log(res);
        if(res.data){

          this.formList.map(x => {

            if ('saleDate' == x.fieldName) {
              x.initialValue = res.data.SALES_DATE==null?null:moment(res.data.SALES_DATE).format('YYYY-MM-DD'); //销售日期
            }
            if ('repairBeginDate' == x.fieldName) {
              x.initialValue = res.data.WRT_BEGIN_DATE==null?null:moment(res.data.WRT_BEGIN_DATE).format('YYYY-MM-DD'); //保修起始日期
            }
            if ('repairEndDate' == x.fieldName) {
              x.initialValue = res.data.WRT_END_DATE==null?null:moment(res.data.WRT_END_DATE).format('YYYY-MM-DD'); //保修起始日期
            }
            if ('engineNo' == x.fieldName) {
              x.initialValue = res.data.ENGINE_NO;
            }
            if ('motorNo' == x.fieldName) {
              x.initialValue = res.data.MOTOR_NO1;
            }
            if ('customerName' == x.fieldName) {
              //车主姓名
              x.initialValue = res.data.OWNER_NAME;
            }
            if ('customerPhone' == x.fieldName) {
              x.initialValue = res.data.MOBILE;
            }
            // 车辆用途
            if ('useType' == x.fieldName) {
              x.initialValue = res.data.VEHICLE_PURPOSE;
            }
            // 车主地址
            if ('address' == x.fieldName) {
              x.initialValue = res.data.ADDRESS;
            }
            //营运性质
            if ('customerType' == x.fieldName) {
              x.initialValue = res.data.BUSINESS_KIND;
            }
            if ('batteryNo' == x.fieldName) {
              x.initialValue = res.data.BATTERY_NO;
            }
          });
        }
      },
      async queryRepairVehicleMessage(val,val1) {
        //掉外部接口 vin 取得工单信息
        let res = await queryRepairVehicleList({ownerCode:val1,vin: val});
        //是否特殊车
        // let isSpecialResult ={};
     //  if(res.data.rows.length){
     // //  res1 = await isSpecialCar(res.data.rows[0].VIN);
     //     isSpecialResult = await translateByVinAndModelCode({vin:res.data.rows[0].VIN,modelCode: res.data.rows[0].MODEL_CODE,customerType: res.data.rows[0].BUSINESS_KIND});
     //
     //    this.formList.map(x => {
     //     //是否特殊车
     //     if ('isSpecial' == x.fieldName) {
     //    //   x.initialValue =Number(isSpecialResult.data.isSpecial);
     //       x.initialValue =this.createDictText(Number(isSpecialResult.data.isSpecial), '5532');
     //     }
     //   });
     // }
        if(res.data.rows.length){

       //   let data = res1.data;

          this.formList.map(x => {
            //车主姓名
            if ('customerName' == x.fieldName) {
              x.initialValue =res.data.rows[0].DELIVERER;
            }
            //车主手机号
            if ('customerPhone' == x.fieldName) {
              x.initialValue =res.data.rows[0].DELIVERER_MOBILE;
            }
            //车辆用途
            if ('useType' == x.fieldName) {
              x.initialValue =this.createDictText(res.data.rows[0].VEHICLE_PURPOSE, '1511');
            }
            //用户属性
            if ('customerType' == x.fieldName) {
             // x.initialValue =this.createDictText(res.data.rows[0].BUSINESS_KIND, '4103'); 外面的字典是4103  咱们的是5584
              x.initialValue =this.createDictText(Number(isSpecialResult.data.customerType), '5584');
            //  x.initialValue =Number(isSpecialResult.data.customerType);
            }
            if ('prodDate' == x.fieldName) {
              x.initialValue =res.data.rows[0].PRODUCT_DATE;
            }
          });
        }
      },
      // async selectRowById(val) {
      //   //掉外部接口 工单号 取得工单信息
      //   let res = await quyRomessage({ roNo: val });
      //   let data = res.data;
      //   for (let i in data) {
      //     this.formList.map((y) => {
      //       if (i == y.fieldName) {
      //         y.initialValue = data[i];
      //       }
      //     });
      //   }
      // },
      async chuqi() {
        const res1 = await cmsClaimTypeStr({ type: 5508 });
        if (res1.resultCode == 200) {
          this.formList1.find(x => x.fieldName == 'authType').itemList = res1.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
        }
        const res2 = await cmsClaimTypeStr({ type: 5504 });
        if (res2.resultCode == 200) {
          this.formList1.find(x => x.fieldName == 'authSub').itemList = res2.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
        }
      },
      formChangeHandle1(val) {
        console.log(val);
        this.saveData1 = val;
      },
      formChangeHandle2(val) {
        console.log(val);
        this.saveData2 = val;
      },
      formChangeHandle3(val) {
        console.log(val);
        this.saveData3 = val;
      },
      formChangeHandle4(val) {
        console.log(val);
        this.saveData4 = val;
      },
      //搜索获取数据
      changeHandle(val) {
        this.fetchParams = val;
        console.log(val);
      },
      //选中
      selectChange(rows) {
        this.selectedRows = rows;
        console.log(this.selectedRows);
      },
      //保存
      async saveDialog() {
        this.$refs.formPanel1.SUBMIT_FORM();
        this.$refs.formPanel2.SUBMIT_FORM();
        this.$refs.formPanel3.SUBMIT_FORM();
        this.$refs.formPanelbeizhu.SUBMIT_FORM();
        let arr = [];
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {

          arr.push(x);
        });
        console.log(arr);

        let arr2 = [];
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
          arr2.push(x);
        });
        console.log(arr2);

        let arr3 = [];
        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
          arr3.push(x);
        });
        console.log(arr3);

        //维修项目
        this.saveData.labourList = arr3;
        //换上件
        this.saveData.partRpList = arr2;
        //附加项目
        this.saveData.addList = arr;

        this.saveData = Object.assign(this.saveData, this.saveData1);

        this.saveData = Object.assign(this.saveData, this.saveData2);

        this.saveData = Object.assign(this.saveData, this.saveData3);
        this.saveData = Object.assign(this.saveData, this.saveData4);
        console.log(this.saveData);
        this.saveData.authId = this.authId;
        this.saveData.partId = this.partId;
        this.saveData.supId = this.supId;
        this.saveData.supCode = this.supCode;
        this.saveData.responsibleId = this.responsibleId;
        this.saveData.responsibleCode = this.responsibleCode;
        this.saveData.labourAmount = this.labourAmount;
        this.saveData.partAmount = this.partAmount;
        this.saveData.modelCode = this.modelCode;
        this.saveData.modelId = this.modelId;
        this.saveData.seriesCode = this.seriesCode;
        this.saveData.seriesId = this.seriesId;
        this.saveData.faId = this.faId; //故障现象主键
        this.saveData.frId = this.frId; //故障原因主键
        this.saveData.outId = this.outId;
        this.saveData.isDeleted = this.isDeleted;
        this.saveData.outNo = this.saveData.outCode;
        //判断是保存还是提交 通过0 驳回1  拒绝2
        if (this.saveFlag == 0) {
          this.saveData.checkStatus = 55031003;
        } else if (this.saveFlag == 1) {
          this.saveData.checkStatus = 55031004;
        } else if (this.saveFlag == 2) {
          this.saveData.checkStatus = 55031005;
        }
        //保存前格式化时间类型
        //销售日期
        this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
        //保修起始日期
        this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
        //保修截止日期
        this.saveData.repairEndDate = moment(this.saveData.repairEndDate).format('YYYY-MM-DD HH:mm:ss');
        //维修开始时间
        this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
        //维修结束时间
        this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
        //自费备件销售日期
        // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
        //生产日期
        this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
        console.log(this.saveData);
        if (this.saveData1 !== null && this.saveData2 !== null && this.saveData3 !== null && this.saveData4 !== null) {
          this.dataObj = copyUpdateData(this.dataObj, this.saveData);
          //编辑的保存
          let res = await approve(this.saveData);
          if (res.resultCode == 200) {
            this.$notify({
              title: '成功',
              message: '操作成功',
              type: 'success',
            });
            if (this.editIds.length) {
              this.editIds[this.index].status = 1;
              this.next();
            } else {
              this.$emit('save');
            }
          } else {
            this.$notify.error({ title: '提示信息', message: res.errMsg || '审核失败!' });
            this.closeDialog();
          }
        }
      },
      //维修项目列表新增
      weixiuxiangmulistadd() {
        this.weixiuxiangmulistaddflag = true;
      },
      //备件换上件
      peijianhuanshangjianadd() {
        this.peijianhuanshangjianlistaddflag = true;
      },
      peijianhuanshangjianlistadd() {
        this.peijianhuanshangjianlistaddflag = true;
      },
      //附加项目列表
      fujiaxiangmuadd() {
        this.fujiaxiangmulistaddflag = true;
      }, //救援单
      jiuyuandanClose() {
        this.jiuyuandanFlag = false;
      },
      jiuyuandanSave(obj) {
        this.outId = obj[0].outId;
        //救援单返显
        this.formList1.map((x) => {
          if ('outNo' == x.fieldName) {
            x.initialValue = obj[0].outCode; //救援号返显
          }
        });

        this.jiuyuandanFlag = false;
      },
      selectoutNo() {
        this.jiuyuandanFlag = true;
      },
      //维修工单
      weixiugongdanClose() {
        this.weixiugongdan = false;
      },
      remarkClose() {
        this.remarkFlag = false;
      },
      remarkSave(obj) {
        this.formListbeizhu.find((x) => x.fieldName == 'checkRemarks').initialValue = obj[0].reasonRemarks;
        this.remarkFlag = false;
      },
      //故障现象
      guzhangxianxiangdaimanClose() {
        this.guzhangxianxiangdaima = false;
      },
      guzhangxianxiangdaimaSave(obj) {
        this.faId = obj[0].faultId;
        this.formList1.map((x) => {
          if ('faultCode' == x.fieldName) {
            x.initialValue = obj[0].faultCode; //故障现象代码返显
          }
          if ('faultName' == x.fieldName) {
            x.initialValue = obj[0].faultName; //故障现象名称返显
          }
          if ('faultAppear' == x.fieldName) {
            x.initialValue = obj[0].faultName; //故障现象名称返显
          }
          if ('sysCode1' == x.fieldName) {
            x.initialValue = obj[0].sysCode1; //一级代码
          }
          if ('sysName1' == x.fieldName) {
            x.initialValue = obj[0].sysName1; //一级名称
          }
          if ('sysCode2' == x.fieldName) {
            x.initialValue = obj[0].sysCode2; //二级代码
          }
          if ('sysName2' == x.fieldName) {
            x.initialValue = obj[0].sysName2; //二级名称
          }
          if ('sysCode3' == x.fieldName) {
            x.initialValue = obj[0].sysCode3; //三级代码
          }
          if ('sysName3' == x.fieldName) {
            x.initialValue = obj[0].sysName3; //三级名称
          }
          if ('sysCode4' == x.fieldName) {
            x.initialValue = obj[0].sysCode4; //代码
          }
          if ('sysName4' == x.fieldName) {
            x.initialValue = obj[0].sysName4; //名称
          }
          if ('sysCode' == x.fieldName) {
            x.initialValue = obj[0].sysCode; //故障代码
          }
          if ('faultAppera' == x.fieldName) {
            x.initialValue = obj[0].faultAppera; //故障现象
          }
        });

        this.guzhangxianxiangdaima = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //故障原因
      guzhangyuanyinClose() {
        this.guzhangyuanyin = false;
      },
      guzhangyuanyinSave(obj) {
        this.frId = obj[0].frId;
        this.formList1.map((x) => {
          if ('frCode' == x.fieldName) {
            x.initialValue = obj[0].frCode; //故障原因代码返显
          }
          if ('frName' == x.fieldName) {
            x.initialValue = obj[0].frName; //故障原因描述返显
          }
        });

        this.guzhangyuanyin = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //自费工单
      zifeigongdanClose() {
        this.zifeigongdanFlag = false;
      },
      zifeigongdanSave(obj) {
        this.selfNo = obj[0].selfNo;
        this.formList1.map((x) => {
          if ('selfNo' == x.fieldName) {
            x.initialValue = obj[0].selfNo; //主损件号返显
          }
          if ('selfSdate' == x.fieldName) {
            x.initialValue = obj[0].selfSdate; //自费备件销售日期返显
          }
          if ('selfMile' == x.fieldName) {
            x.initialValue = obj[0].selfMile; //自费备件销售里程返显
          }
          // if ('selfUseHours' == x.fieldName) {
          //   x.initialValue = obj[0].selfUseHours; //自费备件使用时长返显
          // }
          // if ('selfUseMile' == x.fieldName) {
          //   x.initialValue = obj[0].selfUseMile; //自费备件使用里程返显
          // }
          // if ('ncvcertnon' == x.fieldName) {
          //   x.initialValue = obj[0].certificateNo; //新车证件号
          // }
          // if ('ncvmobilen' == x.fieldName) {
          //   x.initialValue = obj.vtel; //客户电话
          // }
          // if ('ncvvinn' == x.fieldName) {
          //   x.initialValue = obj.vin; //vin
          // }
          // if ('ncvseriescoden' == x.fieldName) {
          //   x.initialValue = obj.seriesCode; //系列
          //   this.seriesCode = obj.seriesName;
          // }
          // if ('ncvseriesname' == x.fieldName) {
          //   x.initialValue = obj.seriesName; //车系名称
          //   this.seriesCode = obj.seriesName;
          // }

          // if ('ncvcartypecoden' == x.fieldName) {
          //   x.initialValue = obj.modelCode; //车型
          // }

          // if ('ncvcartypename' == x.fieldName) {
          //   x.initialValue = obj.salesModelName; //车型名称
          // }

          // if ('ncvbrandcoden' == x.fieldName) {
          //   x.initialValue = obj.brandCode; //品牌代码
          // }
          // if ('vengineanon' == x.fieldName) {
          //   //发动机号
          //   x.initialValue = obj.engineNo; //品牌代码
          // }
          // if ('vcertificateType' == x.fieldName) {
          //   x.initialValue = obj.vcertificateType; // this.createDictText(obj.vcertificateType,'1508', 1)
          // }
          // if ('ncvdidn' == x.fieldName) {
          //   x.initialValue = obj.ownerCode; //新车经销商
          // }
          // if ('ncvdidname' == x.fieldName) {
          //   x.initialValue = obj.dealerName; //新车经销商名称
          // }
          // if ('ncdcreate' == x.fieldName) {
          //   //出库日期
          //   x.initialValue = obj.aakDate; //aak
          // }
          // // if ('ncdnewinvoicen' == x.fieldName) {
          // //   //发票日期
          // //   x.initialValue = obj.invoiceDate;
          // // }
          // if ('dinvoicesum' == x.fieldName) {
          //   x.initialValue = obj.invoiceAmount;
          // }

          // if ('legalFlag' == x.fieldName) {
          //   x.initialValue = ''; /*清空本人/法人置换*/
          //   this.setOldData('N');
          // }
        });

        this.zifeigongdanFlag = false;
        this.fetchParams = { ...this.fetchParams };
      }, //维修项目
      weixiuxiangmulistClose() {
        this.weixiuxiangmulistaddflag = false;
      },
      weixiuxiangmulistSave(val) {
        console.log(val);
        this.visibleAdd = false;
        this.selectedRows = val;
        this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);

        let sumweixiufeiyong = 0;
        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
          sumweixiufeiyong += Number(x.cmsClaimAmount);
        });
        this.feiyongformList.map((x) => {
          if ('labourAmount' == x.fieldName) {
            x.initialValue = Number(sumweixiufeiyong);
          }
        });
        this.sumweixiufeiyongz = sumweixiufeiyong;
        this.sumAmount();
        this.weixiuxiangmulistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //备件换上件
      peijianhuanshangjianClose() {
        this.peijianhuanshangjianlistaddflag = false;
      },
      fujiaxiangmuCloseSave() {
        this.fujiaxiangmuCloselistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //附加项目
      fujiaxiangmuClose() {
        this.fujiaxiangmulistaddflag = false;
      },
      fujiaxiangmuSave(val) {
        this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);

        let sumfujiafeiyong = 0;
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
          sumfujiafeiyong += Number(x.addAmount);
        });
        this.feiyongformList.map((x) => {
          if ('addAmount' == x.fieldName) {
            x.initialValue = Number(sumfujiafeiyong);
          }
        });
        this.sumfujiafeiyongz = sumfujiafeiyong;
        this.sumAmount();
        this.fujiaxiangmulistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },

      //备件换上件
      fujiaxiangmuCloseClose() {
        this.fujiaxiangmuCloselistaddflag = false;
      },
      peijianhuanshangjianSave(val) {
        console.log(val);
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(val);

        let partAmountsum = 0;
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
          this.sumAmountsum += Number(x.cmsClaimPrice);
          partAmountsum += Number(x.cmsClaimPrice);
        });
        this.feiyongformList.map((x) => {
          if ('partAmount' == x.fieldName) {
            x.initialValue = partAmountsum;
          }
        });
        this.partAmountsumz = partAmountsum;
        this.sumAmount();

        // this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
        //   console.log(x.cmsClaimPrice);
        //   this.sumPeiJianFeiYong += Number(x.cmsClaimPrice);
        // });
        // this.feiyongformList.map(x => {
        //   if ('sumCmsClaimPrice' == x.fieldName) {
        //     x.initialValue = this.sumPeiJianFeiYong;
        //   }
        // });
        this.peijianhuanshangjianlistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //拒绝
      async refuse() {
        this.saveFlag = 2;
        console.log('点了拒绝...');
        this.formListbeizhu.find((x) => x.fieldName === 'checkRemarks').rules = [
          {
            required: true,
            message: '请输入审核说明',
            trigger: 'change',
          },
        ];
        if (this.formListbeizhu.find((x) => x.fieldName === 'checkRemarks').initialValue) {
          this.$refs.formPanel1.SUBMIT_FORM();
          this.$refs.formPanel2.SUBMIT_FORM();
          this.$refs.formPanel3.SUBMIT_FORM();
          this.$refs.formPanelbeizhu.SUBMIT_FORM();
          let arr = [];
          this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
            x.cmsClaimType=1;
            arr.push(x);
          });
          let arr1 = [];
          this.$refs.table2.$refs.pageTable.list.map((x) => {
            // delete x.isDeleted
            arr1.push(x);
          });
          console.log(arr);
          let arr2 = [];
          this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
            arr2.push(x);
          });
          console.log(arr2);
          console.log('点了拒绝...3');
          let arr3 = [];
          this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
            x.cmsClaimType=1;
            arr3.push(x);
          });
          console.log(arr3);

          //维修项目
          this.saveData.labourList = arr3;
          //换上件
          this.saveData.partRpList = arr2;
          //附加项目
          this.saveData.addList = arr;
          //换下件
          this.saveData.partList = arr1;
          //厂端附件
          this.$refs.oemFileTable.$refs.pageTable.list.map(x => {
            this.oemFileList.push(x);
          });
          this.saveData.oemFileList = this.oemFileList;
          this.saveData = Object.assign(this.saveData, this.saveData1);

          this.saveData = Object.assign(this.saveData, this.saveData2);

          this.saveData = Object.assign(this.saveData, this.saveData3);
          this.saveData = Object.assign(this.saveData, this.saveData4);
          console.log('点了拒绝');
          this.saveData.authId = this.authId;
          this.saveData.partId = this.partId;
          this.saveData.supId = this.supId;
          this.saveData.supCode = this.supCode;
          this.saveData.responsibleId = this.responsibleId;
          this.saveData.responsibleCode = this.responsibleCode;
          this.saveData.responsiblePerson = this.responsiblePerson;
          this.saveData.labourAmount = this.labourAmount;
          this.saveData.partAmount = this.partAmount;
          this.saveData.modelCode = this.modelCode;
          this.saveData.modelId = this.modelId;
          this.saveData.seriesCode = this.seriesCode;
          this.saveData.seriesId = this.seriesId;
          this.saveData.faId = this.faId; //故障现象主键
          this.saveData.frId = this.frId; //故障原因主键
          this.saveData.outId = this.outId;
          this.saveData.isDeleted = this.isDeleted;
          this.saveData.outNo = this.saveData.outCode;
          //判断是保存还是提交 通过0 驳回1  拒绝2
          if (this.saveFlag == 0) {
            this.saveData.checkStatus = 55031003;
          } else if (this.saveFlag == 1) {
            this.saveData.checkStatus = 55031004;
          } else if (this.saveFlag == 2) {
            this.saveData.checkStatus = 55031005;
          }
          //保存前格式化时间类型
          //销售日期
          this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
          //保修起始日期
          this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
          //保修截止日期
          this.saveData.repairEndDate = moment(this.saveData.repairEndDate).format('YYYY-MM-DD HH:mm:ss');
          //维修开始时间
          this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
          //维修结束时间
          this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
          //自费备件销售日期
          // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
          //生产日期
          this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
          console.log(this.saveData);
          if (this.saveData1 !== null && this.saveData2 !== null && this.saveData3 !== null && this.saveData4 !== null) {
            this.dataObj = copyUpdateData(this.dataObj, this.saveData);
            //编辑的保存
            this.loading = true;
            let res = await approve(this.saveData);
            if (res.resultCode == 200) {
              this.$notify({
                title: '成功',
                message: '操作成功',
                type: 'success',
              });
              if (this.editIds.length) {
                this.editIds[this.index].status = 1;
                this.next();
              } else {
                this.$emit('save');
              }
            } else {
              this.loading = false;
              // this.$notify.error({ title: '提示信息', message: res.errMsg || '审核失败!' });
              // this.closeDialog();
            }
            this.loading = false;
          }
        }
      }, //驳回
      async reject() {
        this.saveFlag = 1;
        this.formListbeizhu.find((x) => x.fieldName === 'checkRemarks').rules = [{ required: true, message: '请输入审核备注', trigger: 'change' }];
        if (this.formListbeizhu.find((x) => x.fieldName === 'checkRemarks').initialValue) {
          this.$refs.formPanel1.SUBMIT_FORM();
          this.$refs.formPanel2.SUBMIT_FORM();
          this.$refs.formPanel3.SUBMIT_FORM();
          this.$refs.formPanelbeizhu.SUBMIT_FORM();
          let arr = [];
          this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
            arr.push(x);
          });
          let arr1 = [];
          this.$refs.table2.$refs.pageTable.list.map((x) => {
            // delete x.isDeleted
            arr1.push(x);
          });
          console.log(arr);
          let arr2 = [];
          this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
            arr2.push(x);
          });
          console.log(arr2);

          let arr3 = [];
          this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
            x.cmsClaimType=1;
            arr3.push(x);
          });
          console.log(arr3);

          //维修项目
          this.saveData.labourList = arr3;
          //换上件
          this.saveData.partRpList = arr2;

          //附加项目
          this.saveData.addList = arr;
          //换下件
          this.saveData.partList = arr1;
          //厂端附件
          this.$refs.oemFileTable.$refs.pageTable.list.map(x => {
            this.oemFileList.push(x);
          });
          this.saveData.oemFileList = this.oemFileList;
          this.saveData = Object.assign(this.saveData, this.saveData1);

          this.saveData = Object.assign(this.saveData, this.saveData2);

          this.saveData = Object.assign(this.saveData, this.saveData3);
          this.saveData = Object.assign(this.saveData, this.saveData4);
          console.log(this.saveData);
          this.saveData.authId = this.authId;
          this.saveData.partId = this.partId;
          this.saveData.supId = this.supId;
          this.saveData.supCode = this.supCode;
          this.saveData.responsibleId = this.responsibleId;
          this.saveData.responsibleCode = this.responsibleCode;
          this.saveData.responsiblePerson = this.responsiblePerson;
          this.saveData.labourAmount = this.labourAmount;
          this.saveData.partAmount = this.partAmount;
          this.saveData.modelCode = this.modelCode;
          this.saveData.modelId = this.modelId;
          this.saveData.seriesCode = this.seriesCode;
          this.saveData.seriesId = this.seriesId;
          this.saveData.faId = this.faId; //故障现象主键
          this.saveData.frId = this.frId; //故障原因主键
          this.saveData.outId = this.outId;
          this.saveData.isDeleted = this.isDeleted;
          this.saveData.outNo = this.saveData.outCode;
          //判断是保存还是提交 通过0 驳回1  拒绝2
          if (this.saveFlag == 0) {
            this.saveData.checkStatus = 55031003;
          } else if (this.saveFlag == 1) {
            this.saveData.checkStatus = 55031004;
          } else if (this.saveFlag == 2) {
            this.saveData.checkStatus = 55031005;
          }
          //保存前格式化时间类型
          //销售日期
          this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
          //保修起始日期
          this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
          //保修截止日期
          this.saveData.repairEndDate = moment(this.saveData.repairEndDate).format('YYYY-MM-DD HH:mm:ss');
          //维修开始时间
          this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
          //维修结束时间
          this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
          //自费备件销售日期
          // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
          //生产日期
          this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
          console.log(this.saveData);
          if (this.saveData1 !== null && this.saveData2 !== null && this.saveData3 !== null && this.saveData4 !== null) {
            this.dataObj = copyUpdateData(this.dataObj, this.saveData);
            //编辑的保存
            this.loading = true;
            let res = await approve(this.saveData);
            if (res.resultCode == 200) {
              this.$notify({
                title: '成功',
                message: '操作成功',
                type: 'success',
              });
              if (this.editIds.length) {
                this.editIds[this.index].status = 1;
                this.next();
              } else {
                this.$emit('save');
              }

            } else {
              this.loading = false;
              // this.$notify.error({ title: '提示信息', message: res.errMsg || '审核失败!' });
              // this.closeDialog();
            }
            this.loading = false;
          }
        }else{
          this.$notify.error({title: '提示信息', message:  '保存失败,请检查数据格式和必填项!'});
        }
        // const res = await zuofeiFun({ ids: rowData.authId, status: '55031002' });
      },
      //取消操作
      closeDialog() {
        this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
      },
      //通过
      async tongGuo() {
        this.saveFlag = 0;
        this.formListbeizhu.find((x) => x.fieldName === 'checkRemarks').rules = [{ required: false, message: '请输入审核说明', trigger: 'change' }];
        this.$refs.formPanel1.SUBMIT_FORM();
        this.$refs.formPanel2.SUBMIT_FORM();
        this.$refs.formPanel3.SUBMIT_FORM();
        this.$refs.formPanelbeizhu.SUBMIT_FORM();
        let arr = [];
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map((x) => {
          arr.push(x);
        });
        console.log(arr);
        let arr1 = [];
        this.$refs.table2.$refs.pageTable.list.map((x) => {
          // delete x.isDeleted
          arr1.push(x);
        });
        let arr2 = [];
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map((x) => {
          arr2.push(x);
        });
        console.log(arr2);

        let arr3 = [];
        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map((x) => {
          x.cmsClaimType=1;
          arr3.push(x);
        });
        console.log(arr3);

        //维修项目
        this.saveData.labourList = arr3;
        //换上件
        this.saveData.partRpList = arr2;
        //附加项目
        this.saveData.addList = arr;
        //换下件
        this.saveData.partList = arr1;
        //厂端附件
        this.$refs.oemFileTable.$refs.pageTable.list.map(x => {
          this.oemFileList.push(x);
        });
        this.saveData.oemFileList = this.oemFileList;

        this.saveData = Object.assign(this.saveData, this.saveData1);

        this.saveData = Object.assign(this.saveData, this.saveData2);

        this.saveData = Object.assign(this.saveData, this.saveData3);
        this.saveData = Object.assign(this.saveData, this.saveData4);
        console.log(this.saveData);
        this.saveData.authId = this.authId;
        this.saveData.partId = this.partId;
        this.saveData.supId = this.supId;
        this.saveData.supCode = this.supCode;
        this.saveData.responsibleId = this.responsibleId;
        this.saveData.responsibleCode = this.responsibleCode;
        this.saveData.responsiblePerson = this.responsiblePerson;
        this.saveData.labourAmount = this.labourAmount;
        this.saveData.partAmount = this.partAmount;
        this.saveData.modelCode = this.modelCode;
        this.saveData.modelId = this.modelId;
        this.saveData.seriesCode = this.seriesCode;
        this.saveData.seriesId = this.seriesId;
        this.saveData.faId = this.faId; //故障现象主键
        this.saveData.frId = this.frId; //故障原因主键
        this.saveData.outId = this.outId;
        this.saveData.isDeleted = this.isDeleted;
        this.saveData.outNo = this.saveData.outCode;
        //判断是保存还是提交 通过0 驳回1  拒绝2
        if (this.saveFlag == 0) {
          this.saveData.checkStatus = 55031003;
        } else if (this.saveFlag == 1) {
          this.saveData.checkStatus = 55031004;
        } else if (this.saveFlag == 2) {
          this.saveData.checkStatus = 55031005;
        }
        //保存前格式化时间类型
        //销售日期
        this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
        //保修起始日期
        this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
        //保修截止日期
        this.saveData.repairEndDate = moment(this.saveData.repairEndDate).format('YYYY-MM-DD HH:mm:ss');
        //维修开始时间
        this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
        //维修结束时间
        this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
        //自费备件销售日期
        // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
        //生产日期
        this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
        console.log(this.saveData);
        if (this.saveData1 !== null && this.saveData2 !== null && this.saveData3 !== null && this.saveData4 !== null) {
          this.dataObj = copyUpdateData(this.dataObj, this.saveData);
          this.loading = true;
          //编辑的保存
          let res = await approve(this.saveData);
          if (res.resultCode == 200) {
            this.$notify({
              title: '成功',
              message: '操作成功',
              type: 'success',
            });
            if (this.editIds.length) {
              this.editIds[this.index].status = 1;
              this.next();
            } else {
              this.$emit('save');
            }
          } else {
            this.loading = false;
            // this.$notify.error({ title: '提示信息', message: res.errMsg || '审核失败!' });
            // this.closeDialog();
          }
          this.loading = false;
        }
      },
      chooseOrderNo() {
        this.visible = true;
      }, //维修工单号选择
      selectRono() {
        this.weixiugongdan = true;
      },
      selectpartCode() {
        this.zhusunjian = true;
      },
      selectfaultCode() {
        this.guzhangxianxiangdaima = true;
      },
      selectfaultReason() {
        this.guzhangyuanyin = true;
      },
      selectselfNo() {
        this.zifeigongdanFlag = true;
      },
      selectRemark() {
        this.remarkFlag = true;
      },
      //责任商选择
      selectResponsibleCode() {
        this.responsible = true;
      },
      responsibleSave(obj) {
        this.formList1.find(x => x.fieldName == 'responsibleCode').initialValue = obj[0].responsibleCode;
        if(obj[0].responsibleType==50041001){
          this.formList1.find(x => x.fieldName == 'responsiblePerson').initialValue = obj[0].responsiblePerson;
        }
        this.responsibleCode = obj[0].responsibleCode;
        this.responsibleId = obj[0].responsibleId;
        this.responsible = false;
      },
      responsibleClose(){
        this.responsible = false;
      },
      add() {},
      createFormList() {
        return [
          {
            type: 'INPUT',
            label: '预授权单号',
            fieldName: 'authNo',
            placeholder: '请输入标题名称...',
            disabled: true
          },
          {
            type: 'INPUT',
            label: 'VIN',
            fieldName: 'vin',
            initialValue: '',
            disabled: true,
            placeholder: '请输入标题名称...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectRono()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '服务中心代码',
            fieldName: 'dealerCode',
            placeholder: '请输入标题名称...',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '服务中心名称',
            fieldName: 'dealerName',
            placeholder: '请输入标题名称...',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '维修工单号',
            fieldName: 'roNo',
            initialValue: '',
            disabled: true,
          },
          {
            type: 'INPUT',
            label: '车牌号',
            fieldName: 'licenseNo',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '车系名称',
            fieldName: 'seriesName',
            disabled: true,
            placeholder: '请输入车系名称...'
          },
          {
            type: 'INPUT',
            label: '车型名称',
            fieldName: 'modelName',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '销售日期',
            fieldName: 'saleDate',
            placeholder: '请输入标题名称...',
            readonly: true, // 只读
            disabled: true,
          },
          {
            type: 'INPUT',
            label: '保修起始日期',
            fieldName: 'repairBeginDate',
            placeholder: '请输入标题名称...',
            readonly: true, // 只读
            disabled: true,
          },
          {
            type: 'INPUT',
            label: '保修截止日期',
            fieldName: 'repairEndDate',
            hidden: true,
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          // {
          //   type: 'INPUT',
          //   label: '生产日期',
          //   fieldName: 'prodDate',
          //   placeholder: '请输入标题名称...',
          //   readonly: true, // 只读
          //   disabled: true,
          // },
          {
            type: 'INPUT',
            label: '发动机号',
            fieldName: 'engineNo',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '电机号',
            fieldName: 'motorNo',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '电池编号',
            disabled: true,
            fieldName: 'batteryNo',
            rules: [{ required: false, message: '请输入电池编号...', trigger: 'blur' }],
            placeholder: '请输入电池编号...'
          },
          {
            type: 'SELECT',
            label: '营运类型',
            fieldName: 'customerType',
            disabled: true,
            initialValue: undefined,
            itemList: this.createDictList('2114')
          },
          {
            type: 'SELECT',
            label: '车辆用途',
            style: { minWidth: '200px' },
            disabled: true,
            fieldName: 'useType',
            itemList: this.createDictList('2115')
          },

          // {
          //   type: 'INPUT',
          //   label: '上次维修里程',
          //   fieldName: 'lastDrive',
          //   disabled: true,
          //   initialValue: '',
          //   unitRender: () => {
          //     return <span>(KM)</span>;
          //   },
          // },
          {
            type: 'INPUT',
            label: '行驶里程',
            unitRender: () => {
              return <span>(KM)</span>;
            },
            fieldName: 'driveMile',
            disabled: true,
            placeholder: '请输入行驶里程...'
          },
          {
            type: 'INPUT',
            label: '车主姓名',
            fieldName: 'customerName',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '车主手机号',
            fieldName: 'customerPhone',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '送修人姓名',
            fieldName: 'deliverer',
            disabled: true,
            placeholder: '请输入送修人姓名...'
          },
          {
            type: 'INPUT',
            label: '送修人手机号',
            fieldName: 'delivererMobile',
            disabled: true,
            placeholder: '请输入送修人手机号...'
          },
          {
            type: 'INPUT',
            label: '提报人',
            fieldName: 'submitName',
            placeholder: '提报人',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '提报人手机号',
            fieldName: 'submitMobile',
            placeholder: '联系方式',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '车主地址',
            fieldName: 'address',
            placeholder: '车主地址...',
            readonly: true,
            disabled: true,
            selfCols: 2
          },
        ];
      },
      createFormList1() {
        return [
          { type: 'SELECT', label: '预授权类型', fieldName: 'authType', placeholder: '请选择', disabled: true, initialValue: '', itemList: [] },
          { type: 'SELECT', label: '常规预授权分类', fieldName: 'authSub',
            placeholder: '请选择常规预授权分类...',
            hidden: true,
            disabled: true,
            filterable: true,
            rules: [{ required: false, message: '请选择常规预授权分类...', trigger: 'blur' }],
          },
          {
            type: 'INPUT',
            label: '主损件代码',
            fieldName: 'partCode',
            disabled: true,
            hidden: true,
            initialValue: '',
            placeholder: '请输入数量...',
            unitRender: (p) => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectpartCode()} />
              </div>
            );
            },
          },
          {
            type: 'INPUT',
            label: '主损件名称',
            fieldName: 'partName',
            disabled: true,
            hidden: true,
            initialValue: '',
            placeholder: '请输入数量...',
          },
          {
            type: 'INPUT',
            label: '超保里程',
            fieldName: 'overMile',
            disabled: true,
            initialValue: 0,
            placeholder: '请输入...'
          },
          {
            type: 'INPUT',
            label: '超保天数',
            fieldName: 'overDays',
            disabled: true,
            initialValue: 0,
            placeholder: '请输入...'
          },
          {
            type: 'INPUT',
            label: '供应商代码',
            fieldName: 'supCode',
            placeholder: '请选择供应商',
            disabled: true,
            hidden: true,
            rules: [{ required: false, message: '请选择供应商', trigger: 'blur' }],
            unitRender: (p) => {
              return (
                <div>
                  <multiuse-button icon="el-icon-search" onClick={() => this.selectSuppliersCode()} />
                </div>
              );
            },
          },
          {
            type: 'INPUT',
            label: '供应商名称',
            fieldName: 'supName',
            disabled: true,
            hidden: true,
            placeholder: '请输入...'
          },
          { type: 'INPUT',
            label: '责任商代码',
            fieldName: 'responsibleCode',
            readonly: true,
            placeholder: '请选择责任商...',
            rules: [{ required: true, message: '请选择责任商', trigger: 'blur' }],
            unitRender: p => {
              return (
                <div>
                  <multiuse-button icon="el-icon-search" onClick={() => this.selectResponsibleCode()} />
                </div>
              );
            }
          },
          {
            type: 'INPUT',
            label: '责任商名称',
            fieldName: 'responsiblePerson',
            disabled: true,
            hidden: true,
            placeholder: '请输入...'
          },
          // {
          //   type: 'INPUT',
          //   label: '故障现象代码',
          //   fieldName: 'faultCode',
          //   disabled: true,
          //   initialValue: '',
          //   placeholder: '请输入数量...',
          //   unitRender: (p) => {
          //     return (
          //       <div>
          //       <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
          //     </div>
          //   );
          //   },
          // },
          // {
          //   type: 'INPUT',
          //   label: '故障现象描述',
          //   fieldName: 'faultName',
          //   disabled: true,
          //   initialValue: '',
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '一级代码',
          //   fieldName: 'sysCode1',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          //
          // {
          //   type: 'INPUT',
          //   label: '一级名称',
          //   fieldName: 'sysName1',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '二级代码',
          //   fieldName: 'sysCode2',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          //
          // {
          //   type: 'INPUT',
          //   label: '二级名称',
          //   fieldName: 'sysName2',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '三级代码',
          //   fieldName: 'sysCode3',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          //
          // {
          //   type: 'INPUT',
          //   label: '三级名称',
          //   fieldName: 'sysName3',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          //
          // {
          //   type: 'INPUT',
          //   label: '故障代码',
          //   fieldName: 'sysCode4',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          {
            type: 'INPUT',
            label: '故障现象',
            fieldName: 'sysName4',
            disabled: true,
            placeholder: '请输入数量...',
          },

          // {
          //   type: 'INPUT',
          //   label: '故障原因代码',
          //   fieldName: 'frCode',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          //   unitRender: (p) => {
          //     return (
          //       <div>
          //       <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultReason()} />
          //     </div>
          //   );
          //   },
          // },
          {
            type: 'INPUT',
            label: '故障原因',
            disabled: true,
            fieldName: 'frName',
            placeholder: '请输入...',
          },

          // {
          //   type: 'INPUT',
          //   label: '外出救援单号',
          //   fieldName: 'outNo',
          //   //fieldName: 'outCode',
          //   disabled: true,
          //   placeholder: '请输入救援单号...',
          //   unitRender: (p) => {
          //     return (
          //       <div>
          //       <multiuse-button icon="el-icon-search" onClick={() => this.selectoutNo()} />
          //     </div>
          //   );
          //   },
          // },
          // {
          //   type: 'INPUT',
          //   label: '自费工单选择',
          //   fieldName: 'selfNo',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          //   unitRender: (p) => {
          //     return (
          //       <div>
          //       <multiuse-button icon="el-icon-search" onClick={() => this.selectselfNo()} />
          //     </div>
          //   );
          //   },
          // },
          // {
          //   type: 'DATE',
          //   label: '自费备件销售日期',
          //   fieldName: 'selfSdate',
          //   disabled: true,
          //   valueFormat: 'yyyy-MM-DD',
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '自费备件销售里程',
          //   fieldName: 'selfMile',
          //   disabled: true,
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '自费备件使用时长',
          //   disabled: true,
          //   fieldName: 'selfUseHours',
          //   placeholder: '请输入数量...',
          // },
          // {
          //   type: 'INPUT',
          //   label: '自费备件使用里程',
          //   disabled: true,
          //   fieldName: 'selfUseMile',
          //   placeholder: '请输入数量...',
          // },
          {
            type: 'TEXT_AREA',
            label: '赔付原因',
            fieldName: 'payReason',
            rules: [{ required: false, message: '请输入赔付原因...', trigger: 'blur' }],
            disabled: true,
            placeholder: '请输入赔付原因...',
            rows: 3,
            selfCols: 4 // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '故障现象描述',
            fieldName: 'faultAppear',
            disabled: true,
            rows: 3,
            selfCols: 4, // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '故障原因描述',
            fieldName: 'faultReason',
            placeholder: '故障原因',
            disabled: true,
            rows: 3,
            selfCols: 4, // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '维修方案描述',
            fieldName: 'cmsClaimPgm',
            placeholder: '维修方案',
            disabled: true,
            rows: 3,
            selfCols: 4, // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '处理措施描述',
            fieldName: 'handleResult',
            placeholder: '处理结果描述',
            readonly: true,
            disabled: true,
            rows: 3,
            selfCols: 4 // 元素占据几行
          },
          {
            type: 'BREAK_SPACE',
            label: '附件'
          },
          {
            type: 'UPLOAD_IMG',
            label: 'VIN',
            fieldName: 'wayPicture',
            placeholder: '上传身份证...',
            selfCols: 1,
            initialValue: [],
            disabled: true,
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '里程（仪表）',
            fieldName: 'wayPicture1',
            placeholder: '上传身份证...',
            selfCols: 1,
            initialValue: [],
            disabled: true,
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '车牌（车头）',
            fieldName: 'wayPicture2',
            placeholder: '上传身份证...',
            selfCols: 2,
            initialValue: [],
            disabled: true,
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true,

            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '行驶证',
            disabled: true,
            fieldName: 'wayPicture3',
            placeholder: '上传身份证...',
            selfCols: 1,
            initialValue: [],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '故障照片',
            fieldName: 'wayPicture4',
            placeholder: '上传身份证...',
            initialValue: [],
            selfCols: 1,
            disabled: true,
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '故障照片',
            fieldName: 'wayPicture5',
            placeholder: '上传身份证...',
            selfCols: 1,
            initialValue: [],
            disabled: true,
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true,
              isFileName: true,
              isPreview: true
            }
          }
        ];
      },
      createdTable() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 70,
            fixed: 'left',
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          {
            title: '附件标题',
            dataIndex: 'title',
            showOverflowTooltip: true,
            render: p => {
              return (
                // <a style="color:#bb0a30" href={p.row.fileUrl} target="_blank" download={p.row.title}>
                //   {p.row.title}
                // </a>
                <div>
                  <el-button style="color:#bb0a30" size="mini" type="text" onClick={() => this.downloadFile(p.row.fileUrl)}>
                    {p.row.title}
                  </el-button>
                </div>
              );
            }
          },
          {
            title: '上传日期',
            dataIndex: 'createdAt'
          },
        ];
      },
      createdTableOem() {
          return [
            {
              title: '序号',
              dataIndex: 'index',
              width: 70,
              fixed: 'left',
              sorter: true,
              render: props => {
                return <span>{props.row.index + 1}</span>;
              }
            },
            {
              title: '操作',
              dataIndex: 'column-action',
              width: 90,
              render: (props, h) => {
                return (
                  <div>
                    <el-button size="mini" type="text" onClick={() => this.oemDelVideo(props.row)}>
                      删除
                    </el-button>
                  </div>
                );
              }
            },
            {
              title: '附件标题',
              dataIndex: 'title',
              showOverflowTooltip: true,
              render: p => {
                return (
                  // <a style="color:#bb0a30" href={p.row.fileUrl} target="_blank" download={p.row.title}>
                  //   {p.row.title}
                  // </a>
                  <div>
                    <el-button style="color:#bb0a30" size="mini" type="text" onClick={() => this.downloadFile(p.row.fileUrl)}>
                      {p.row.title}
                    </el-button>
                  </div>
                );
              }
            },
            {
              title: '上传日期',
              dataIndex: 'createdAt'
            },
          ];
        },
      //维修项目列表
      creatHeader() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: (props) => {
              return <span>{props.row.index + 1}</span>;
            },
          },
          {
            title: '主工位', dataIndex: 'isMain', sorter: true, align: 'center',
            render: (props) => {
              return <el-radio v-model={this.radioIndex} disabled="true" label={props.row.index}></el-radio>
            }
          },
          { title: '维修项目代码', dataIndex: 'labourCode', sorter: true },
          { title: '维修项目名称', dataIndex: 'labourName', sorter: true },
          { title: '维修类型', dataIndex: 'repairTypeName', sorter: true },
          { title: '索赔工时', dataIndex: 'labourHours', sorter: true, minWidth: 120},
          { title: '索赔工时单价', dataIndex: 'cmsClaimPrice', sorter: true },
          { title: '索赔金额', dataIndex: 'cmsClaimAmount', sorter: true }
        ];
      },
      //备件换上件
      creatHeader1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: (props) => {
              return <span>{props.row.index + 1}</span>;
            },
          },
          { title: '备件代码', dataIndex: 'partCode', sorter: true },
          { title: '备件名称', dataIndex: 'partName', sorter: true },
          { title: '单位', dataIndex: 'partUnit', sorter: true },
          { title: '数量', dataIndex: 'partCount', sorter: true },
          { title: '索赔单价', dataIndex: 'cmsClaimPrice', sorter: true },
          { title: '索赔金额', dataIndex: 'cmsClaimAmount', sorter: true },
          // { title: '是否电池', dataIndex: 'ifEv', sorter: true },
          // { title: '电池编号', dataIndex: 'evNo', sorter: true },
        ];
      },
      //换下件
      columnshuanxiajianFn() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            fixed: 'left',
            render: (props) => {
              return <span>{props.row.index + 1}</span>;
            },
          },
          {
            title: '主因件', dataIndex: 'isMain', sorter: true, align: 'center',
            render: (props) => {
              return <el-radio v-model={this.radioPartIndex} disabled="true"  label={props.row.index}></el-radio>
            }
          },
          { title: '备件代码', dataIndex: 'partCode', sorter: true },
          { title: '备件名称', dataIndex: 'partName', sorter: true },
          { title: '单位', dataIndex: 'partUnit', sorter: true },
          // { title: '剩余数量', dataIndex: 'lessCount', sorter: true },
          { title: '数量', dataIndex: 'partCount', editable: false,
            editType: 'number',
            editValidator:(val, row, callback) => {
              if(row.partCount<0){
                this.$notify.error({ title: '提示信息', message: '换下件最小数量为0' });
                row.partCount = 0
              }
            }

          },
          // { title: '备件回运类型', dataIndex: 'returnType', sorter: true, dictItems:[] },
          // { title: '备件代码', dataIndex: 'partId', hidden: true },
        ];
      },
      //附加项目列表
      columnsfujiaxiangmu1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: (props) => {
              return <span>{props.row.index + 1}</span>;
            },
          },
          // {
          //   title: '操作',
          //   dataIndex: 'column-action',
          //   width: 130,
          //   render: props => {
          //     return (
          //       <div style="text-align:center">
          //         <multiuse-button type="text" onClick={() => this.editFile(props.row)} >
          //           上传附件
          //         </multiuse-button>
          //       </div>
          //     );
          //   }
          // },
          { title: '附加项目代码', dataIndex: 'addCode', sorter: true },
          { title: '附加项目名称', dataIndex: 'addName', sorter: true },
          { title: '附加项目费用', dataIndex: 'addAmount', sorter: true },
          { title: '备注', dataIndex: 'addRemark', sorter: true },
        ];
      },
      //审核历史列表
      checkHisList1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: (props) => {
              return <span>{props.row.index + 1}</span>;
            },
          },
          { title: '操作人', dataIndex: 'checkBy', sorter: true },
          { title: '操作时间', dataIndex: 'updatedAt', sorter: true },
          { title: '操作后状态', dataIndex: 'statusStr', sorter: true },
          { title: '审核级别', dataIndex: 'levelName', sorter: true },
          { title: '操作备注', dataIndex: 'checkRemarks', sorter: true }
        ];
      },
      //费用信息
      feiyongformList1() {
        return [
          {
            type: 'INPUT',
            label: '合计费用',
            fieldName: 'sumAmount',
            initialValue: '0.00',
            disabled: true,
            readonly: true, // 只读
          },
          {
            type: 'INPUT',
            label: '工时费用',
            fieldName: 'labourAmount',
            initialValue: '0.00',
            disabled: true,
            readonly: true, // 只读
          },
          {
            type: 'INPUT',
            label: '备件费用',
            fieldName: 'partAmount',
            initialValue: '0.00',
            disabled: true,
            readonly: true, // 只读
          },
          {
            type: 'INPUT',
            label: '备件管理费用',
            fieldName: 'partManageAmount',
            initialValue: '0.00',
            disabled:true,
            readonly: true // 只读
          },
          {
            type: 'INPUT',
            label: '附加项目费用',
            fieldName: 'addAmount',
            initialValue: '',
            disabled: true,
            readonly: true, // 只读
          },
        ];
      },

      //审核备注
      formListbeizhuform() {
        return [
          {
            type: 'INPUT',
            label: '审核备注',
            fieldName: 'checkRemarks',
            placeholder: '请输入备注...',
            initialValue: '',
            row: 3,
            maxlength:200,
            rules: [{ required: false, message: '请输入备注', trigger: 'blur' }]
          },
        ];
      },

      /**维修项目删除方法 */
      deleteFunweixiu(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success',
            });
            this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]); //cmsClaimAmount
            this.feiyongformList.map((x) => {
              if ('labourAmount' == x.fieldName) {
                x.initialValue = this.sumweixiufeiyongz - Number(costItem.cmsClaimAmount);
                this.sumAmount();
              }
            });
          })
      } /**备件换上件删除方法 */,
      deleteFunshangjian(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success',
            });
            this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_DELETE([costItem]);
            this.feiyongformList.map((x) => {
              if ('partAmount' == x.fieldName) {
                x.initialValue = this.partAmountsumz - Number(costItem.cmsClaimPrice);
                this.sumAmount();
              }
            });
          })
      }  /*附加项目删除方法 */,
      deleteFunfujia(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success',
            });
            this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]);
            this.feiyongformList.map((x) => {
              if ('addAmount' == x.fieldName) {
                x.initialValue = this.sumfujiafeiyongz - Number(costItem.addAmount);
                this.sumAmount();
              }
            });
          })
      },
    },
  };
</script>

<style lang="less" scoped>
.claim_check {
  /deep/ .el-textarea__inner {
    color: #000 !important;
  }
}
</style>
